|
|
|
|
|
|
|
The program has two possible states: The normal state is the idle state during which the user interface is enabled; the execution state is entered when you start a service state change. It can take a while for services to start or stop, so a timer, which waits until each service has entered the requested state, runs during the execution state. The EnablePanel function is used to disable the user interface while the program is in the execution state and re-enable it when the program returns to the idle state. It also controls the timer and the cursor display. |
|
|
|
|
|
|
|
|
' Enables or disables the user interface of the application.
' Also controls the mouse pointer and timer.
' The UI must be disabled while service start or stop is in progress
Private Function EnablePanel(ByVal bEnabled As Boolean)
cmdStop.Enabled = bEnabled
cmdStart.Enabled = bEnabled
cmdRestore.Enabled = bEnabled
lstServices.Enabled = bEnabled
If Not bEnabled Then
Screen.MousePointer = vbHourglass
Timeri.Enabled = True
Else
Screen.MousePointer = vbNormal
Timer1.Enabled = False
End If
End Function |
|
|
|
|
|
|
|
|
The first step toward performing a start or stop operation is to obtain a list of services to operate on. The OpenSelectedServices object builds a collection of the services that are selected on the list box. It does this by first loading the ServiceCollection collection with the available services and their current status. The function then compares the names in the list with the available services and adds those that match into the ChangesInProgress collection. |
|
|
|
|
|
|
|
|
' Loads the ChangesInProgress collection with the
' ServiceObject objects for the selected services
Private Function OpenSelectedServices()
Dim index&
Dim currententry$
Dim svcstat As ServiceStatus
Call LoadList(False)
Set ChangesInProgress = New Collection |
|
|
|
|
|